package com.dialogs;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;
import android.widget.TextView;

import com.senditcertified.mail.R;

public class InforConfirmDialog extends Dialog implements
		android.view.View.OnClickListener {
	/*
	 * UI FIELDS
	 */
	private View mVConfirm, mVCancel;
	private ImageView mImvPositive;
	private TextView mTvTitle, mTvMessage, mTvPositive;
	private String sTitle = null;
	private String sMessage = null;

	public InforConfirmDialog(Context context) {
		super(context);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setBackgroundDrawableResource(android.R.color.transparent);
		setContentView(R.layout.dialog_confirm);
		initUI();
		initAction();
	}

	public void setTitle(String sTitle) {
		this.sTitle = sTitle;
	}

	public void setMessage(String sMessage) {
		this.sMessage = sMessage;
	}

	private void initUI() {
		mVConfirm = (View) findViewById(R.id.ln_positive);
		mVCancel = (View) findViewById(R.id.ln_negative);
		mImvPositive = (ImageView) findViewById(R.id.imv_positive);
		mTvPositive = (TextView) findViewById(R.id.tv_positive);
		mTvTitle = (TextView) findViewById(R.id.tv_title);
		mTvMessage = (TextView) findViewById(R.id.tv_message);
	}

	private void initAction() {
		mVConfirm.setOnClickListener(this);
		mVCancel.setOnClickListener(this);
		mTvTitle.setText(sTitle);
		mTvMessage.setText(sMessage);
		mImvPositive.setImageResource(R.drawable.ic_save_contact);
		mTvPositive.setText("OK");
		mVCancel.setVisibility(View.GONE);
	}

	@Override
	public void onClick(View v) {
		if (v == mVConfirm) {
			this.dismiss();
			onConfirm();
		}
	}

	public void onConfirm() {
	}

	public void onCancel() {
	}

}
